<?php

class AdminBaseAction extends Action {

	/**
	 * 后台基类 主要是权限检测  初始化参数
	 * @return [type] [description]
	 */
	public function _initialize() {
		$data = D('Menu')->MenuByJson();
		$this->assign('MenuJson' , $data);
		// import('ORG.Util.Auth');
		// $Auth = new Auth();
		// $authName =  GROUP_NAME.'/'.MODULE_NAME.'/'.ACTION_NAME;
		// $ret = $Auth->check($authName ,1);
		// if($ret === false) {
		// 	exit('No Auth!');
		// }

		// $ret2 = $Auth->getGroups(1);
		// $this->_topMenu();
		// $this->getLeftMenu();
		$this->assign('NOW_PATH',GROUP_NAME.'/'.MODULE_NAME.'/'.ACTION_NAME);
	}

	/**
	 * 获取顶级菜单
	 * @return array 顶级菜单
	 */
	private function _topMenu() {
		$data = D('Menu')->getList(array('parent'=>0 , 'status'=>1));
		$this->assign('top_menu' , $data);
	}

	/**
	 * 左侧菜单
	 * @param  [type] $menuid [description]
	 * @return          [description]
	 */
	public function getLeftMenu($menuid = 2) {
		$data = D('Menu')->getList(array('parent'=>$menuid , 'status'=>1));
		$this->assign('leftMenu' , $data);
	}
}